package com.xdf.wxbebarrel.model;

import com.xdf.wxbebarrel.utils.DevMaterial;

import java.util.Arrays;

public class WxJsApiConfig1 {
    private static final String defaultAppId = DevMaterial.JZY.APPID;

    private Boolean debug;
    private String appId;
    private String timestamp;
    private String nonceStr;
    private String signature;
    private String[] jsApiList;

    private static final long serialVersionUID = 1L;

    public WxJsApiConfig1(String timestamp,String signature){
        this.debug = true;
        this.appId = DevMaterial.JZY.APPID;
        this.timestamp = timestamp;
        this.nonceStr = "chanchaw";
        this.signature = signature;
        // checkJsApi 用于检测设备是否支持想要使用的JSAPI
        // scanQRCode 调用摄像头的JSAPI
        this.jsApiList = new String[]{"checkJsApi","scanQRCode"};
    }

    // 最终使用本方法实例化一个配置对象返回给前端使用
    // 上面的两个参数的构造函数在 2020年7月25日 弃用
    public WxJsApiConfig1(String timestamp,String nonceStr,String signature){
        this.debug = true;
        this.appId = DevMaterial.JZY.APPID;
        this.timestamp = timestamp;
        this.nonceStr = nonceStr;
        this.signature = signature;
        // checkJsApi 用于检测设备是否支持想要使用的JSAPI
        // scanQRCode 调用摄像头的JSAPI
        this.jsApiList = new String[]{"checkJsApi","scanQRCode"};
    }

    public static String getDefaultAppId() {
        return defaultAppId;
    }

    public Boolean getDebug() {
        return debug;
    }

    public void setDebug(Boolean debug) {
        this.debug = debug;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public String[] getJsApiList() {
        return jsApiList;
    }

    public void setJsApiList(String[] jsApiList) {
        this.jsApiList = jsApiList;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    @Override
    public String toString() {
        return "WxJsApiConfig1{" +
                "debug=" + debug +
                ", appId='" + appId + '\'' +
                ", timestamp='" + timestamp + '\'' +
                ", nonceStr='" + nonceStr + '\'' +
                ", signature='" + signature + '\'' +
                ", jsApiList=" + Arrays.toString(jsApiList) +
                '}';
    }
}
